import os

from keras.callbacks import ModelCheckpoint, LearningRateScheduler, LambdaCallback

from mycallback import MyCallback
from callback.earlystop import EarlyStopping

checkpoint_path = f'{os.path.dirname(os.path.realpath(__file__))}/covid-convnet.h5'
from datamanager import data_manager


def scheduler(epoch, learning_rate):
    # return learning_rate/1.2
    return learning_rate


keras_callbacks = [
    EarlyStopping(),
    MyCallback(validation_data=(data_manager.x_test, data_manager.y_test)),
    # MyModelCheckpoint(),
    # ModelCheckpoint(checkpoint_path, monitor='val_acc', save_best_only=True, mode='max', save_weights_only=True),
    LearningRateScheduler(scheduler),
]
